package com.friends.gobrs;

import cn.hutool.json.JSONUtil;
import com.gobrs.async.core.GobrsAsync;
import com.gobrs.async.core.common.domain.AsyncResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *
 * <a href="https://async.sizegang.cn/">Gobrs-Async</a>
 * @Author Zhao Tianhao
 * @Description
 * @Date 2024/9/10 14:28
 */
@Slf4j
@RestController
@RequestMapping("/gobrs")
public class GobrsTest {

	@Resource
	private GobrsAsync gobrsAsync;


	@GetMapping("/test")
	public void test() {
		AsyncResult asyncResult = gobrsAsync.go("test", () -> null);
		log.info("这是执行的最终结果：{}", JSONUtil.toJsonStr(asyncResult));
	}
}
